<?php
class KomaSystemMainMenu extends KomaBlock
{
    function main()
    {   
        $menus = array();
        
        $menus['home']['name'] = T_('Home');
        $menus['home']['link'] = KOMA_URL;
        
        $query = "SELECT * FROM ".$this->Database->prefix('components')." WHERE hasmain = 1";
        $this->Database->query($query);
        
        while($row = $this->Database->fetchArray())
        {
            $menus[$row['name']]['name'] = $row['name'];
            $menus[$row['name']]['link'] = KOMA_URL.'/components/'.$row['dirname'].'/';
        }
        
        $this->Title = T_('Main Menu');
        $this->Template->File = 'mainmenu.html';
        $this->Template->assign('menus', $menus);
        
        return true;
    }
}
?>
